package dfbz.异常;

public class test01 {
    public static void main(String[] args) {
        int arr[]={1,2,3,4,5,6};
        demo01(arr,6);
    }

    private static void demo01(int[] arr,int index) {
        if(index<0||index>=arr.length){
            throw new IndexOutOfBoundsException("数组索引越界异常");
        }else {
            System.out.println(arr[index]);
        }
    }
}
